package com.itheima.dao;

import com.itheima.domain.Book;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface BookDao {
    @Insert("insert into tbl_book(type,name,description) values(#{type},#{name},#{description})")
    //增加
    public int save(Book book);

    @Update("update tbl_book set type=#{type},name=#{name},description=#{description} where id=#{id}")
    //更新
    public int update(Book book);

    @Delete("delete from tbl_book where id=#{id}")
    //删除
    public int delete(Integer id);

    @Select("select *from tbl_book where id=#{id}")
    //根据id查询
    public Book selectById(Integer id);

    @Select("select *from tbl_book")
    //查询所有
    public List<Book> getAll();
}
